package org.ziegler.log.analysis;

import java.util.List;

import org.ziegler.log.analysis.core.FileUtils;

public class LogCore {

    public static void log(String log) {
        write("", log);
    }

    public static void info(String log) {
        write("[INFO]", log);
    }

    public static void error(String log) {
        write("[ERROR]", log);
    }

    public static void warn(String log) {
        write("[WARN]", log);
    }

    public static void debug(String log) {
        write("[DEBUG]", log);
    }

    private static void write(String level, String log) {
        final String s = new StringBuilder().append(level).append(log).toString();
        System.out.println(s);
        FileUtils.appendWriteLines(ConstUtils.UPDATE_LOG_FILENAME, List.of(s));
    }
}
